home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # $Id: install,v 1.33 1997/03/20 23:48:36 beth Exp $
- #
- # install
- #
- # Research Systems, Inc March 1, 1988
- # This shell script carries out the steps required to install IDL
- # or an IDL based product once the main directory has been unpacked.
- # It expects to be run from the RSI directory. If no arguments are
- # present, the latest IDL version is used, otherwise:
- #
- # $1 Product name
- # $2 Version
- #
-
- # Make sure whoami is found on Solaris
- PATH="$PATH:/usr/ucb"
- USER=`whoami`
- LANDMARK=resource/fonts/hersh1.chr
-
-
- # Establish the name (upper and lower case) and the version.
- NAME=IDL # Assume that plain IDL is being installed
- PRODUCT=idl
- VERSION=5
- IDL_VERSION=5 # The current shipping version.
- LAYERED=0
-
- if [ "$1" != "" ]; then
- NAME=`echo $1 | tr [a-z] [A-Z]`
- PRODUCT=`echo $NAME | tr [A-Z] [a-z]`
- if [ "$PRODUCT" != "idl" ]; then
- LAYERED=1 # There is a layered product on top.
- if [ "$2" != "" ]; then
- VERSION=$2 # This is its version
- fi
- fi
- fi
-
- RSIDIR=`pwd`
- IDLBIN=${RSIDIR}/idl_$IDL_VERSION/bin
- PRODUCTBIN=${RSIDIR}/${PRODUCT}_${VERSION}/bin
- PRODUCT_VERSION=${PRODUCT}_${VERSION}
- PRODUCT_RT=${PRODUCT}_rt
- PRODUCT_RT_VERSION=${PRODUCT}_rt_${VERSION}
- PRODUCTHELP=${PRODUCT}help
- PRODUCTHELP_VERSION=${PRODUCT}help_${VERSION}
-
-
- # Preserve the file modes in the source tar files
- umask 000
-
- if [ ! -f $RSIDIR/idl_$IDL_VERSION/$LANDMARK ]; then
- echo "
- The current directory must be set to the RSI directory.
- Change the default to the RSI directory and re-run
- this script.
- "
- exit 1
- fi
-
- echo "
- This script installs Unix $NAME version $VERSION. The current
- directory is assumed to be the RSI directory under
- which $NAME is to be installed.
-
- Current directory: " $RSIDIR "
- Current login: $USER
- "
-
- if [ "$USER" != root ]; then
- echo "
- If this installation is into a public directory,
- you should login as root to do this installation.
- "
- fi
-
- if [ `sh $IDLBIN/yesno "Do you wish to continue"` = 0 ]; then exit 1; fi
-
- # Update the generic idl, idl_demo and product symlinks for this platform.
-
- if [ -d idl_$IDL_VERSION ]; then
- rm -f idl
- ln -s idl_$IDL_VERSION idl
- fi
-
- #if [ -d idl_demo_$IDL_VERSION ]; then
- # rm -f idl_demo
- # ln -s idl_demo_$IDL_VERSION idl_demo
- #fi
-
- if [ \( "$LAYERED" = "1" \) -a \( -d $PRODUCT_VERSION \) ]; then
- rm -f $PRODUCT
- ln -s $PRODUCT_VERSION $PRODUCT
- fi
-
- # Symbolic links.
-
- if [ "$LAYERED" = "1" ]; then
- EXTRA_LN="
- ln -s \$RSI/$PRODUCT/bin/$PRODUCT LOCAL_DIR/$PRODUCT
- ln -s \$RSI/$PRODUCT_VERSION/bin/$PRODUCT LOCAL_DIR/$PRODUCT_VERSION
- ln -s \$RSI/$PRODUCT/bin/$PRODUCT_RT LOCAL_DIR/$PRODUCT_RT
- ln -s \$RSI/$PRODUCT_VERSION/bin/$PRODUCT_RT LOCAL_DIR/$PRODUCT_RT_VERSION
- ln -s \$RSI/$PRODUCT/bin/$PRODUCTHELP LOCAL_DIR/$PRODUCTHELP
- ln -s \$RSI/$PRODUCT_VERSION/bin/$PRODUCTHELP LOCAL_DIR/$PRODUCTHELP_VERSION"
- fi
-
-
- echo "
- There are 3 ways to create the symbolic links or define
- the environment variables necessary to run $NAME:
-
- 1) Allow this script to install $NAME in the RSI recommended
- manner:
-
- - If the rsi directory tree (of which $NAME is a
- subdirectory) is not located in /usr/local/rsi,
- create a symbolic link called /usr/local/rsi that points
- at it.
-
- - Create symbolic links in /usr/local/bin for idl and
- related commands. To run $NAME, users must put
- /usr/local/bin in their execution paths. At most sites,
- this is already the case.
-
- 2) You can manually create the symbolic links using the commands:
-
- setenv RSI $RSIDIR
- ln -s \$RSI /usr/local/rsi $EXTRA_LN
-
- ln -s \$RSI/idl_$IDL_VERSION/bin/idl LOCAL_DIR/idl_$IDL_VERSION
- ln -s \$RSI/idl/bin/idl LOCAL_DIR/idl
-
- ln -s \$RSI/idl_$IDL_VERSION/bin/idlde LOCAL_DIR/idlde_$IDL_VERSION
- ln -s \$RSI/idl/bin/idlde LOCAL_DIR/idlde
-
- ln -s \$RSI/idl_$IDL_VERSION/bin/idlrpc LOCAL_DIR/idlrpc_$IDL_VERSION
- ln -s \$RSI/idl/bin/idlrpc LOCAL_DIR/idlrpc
-
- ln -s \$RSI/idl_$IDL_VERSION/bin/insight LOCAL_DIR/insight_$IDL_VERSION
- ln -s \$RSI/idl/bin/insight LOCAL_DIR/insight
-
- ln -s \$RSI/idl_$IDL_VERSION/bin/idlhelp LOCAL_DIR/idlhelp_$IDL_VERSION
- ln -s \$RSI/idl/bin/idlhelp LOCAL_DIR/idlhelp
- ln -s \$RSI/idl_$IDL_VERSION/bin/idldemo LOCAL_DIR/idldemo_$IDL_VERSION
- ln -s \$RSI/idl/bin/idldemo LOCAL_DIR/idldemo
-
- where LOCAL_DIR is the path of a directory on your system
- that commonly appears in users' paths.
-
- 3) Files named ${PRODUCT}_setup and ${PRODUCT}_setup.ksh are
- automatically created by the installation script. These
- files contain appropriate definitions for $NAME-related
- environment variables and aliases. If you choose this
- option, you must have your users set up their accounts
- as shown below:
-
- Have your C-shell users add the line:
-
- source $RSIDIR/$PRODUCT/bin/${PRODUCT}_setup
-
- to their .cshrc files.
-
- Have your Korn shell users add the line:
-
- . $RSIDIR/$PRODUCT/bin/${PRODUCT}_setup.ksh
-
- to their .profile files.
- " | more
-
- if [ `sh $IDLBIN/yesno "Create the symbolic links described in option 1 above"` = 0 ]; then
- echo "
- Symbolic links were not created.
-
- After the installation script exits, you must follow
- the instructions as described in (2) or (3) above."
- else
- echo " "
- # If the system lacks /usr/local or /usr/local/bin, then create them.
- # If we're not root, then don't bother
- if [ "$USER" = root ]; then
- for DIR in local local/bin; do
- if [ ! -d /usr/$DIR ]; then
- echo "System lacks directory /usr/$DIR. Creating..."
- mkdir /usr/$DIR
- chmod 775 /usr/$DIR
- fi
- done
- fi
-
-
- STATUS=0
-
- # Link RSI directory to /usr/local/rsi. If we are already there,
- # the symbolic link will fall harmlessly inside the rsi
- # directory where we'll find and remove it.
- if [ "$RSIDIR" != "/usr/local/rsi" ]; then # This if-stmt is not foolproof
- $IDLBIN/make_link $RSIDIR /usr/local/rsi
- if [ $? != 0 ]; then STATUS=1; fi
- if [ -w $RSIDIR/rsi ]; then rm -f $RSIDIR/rsi; fi
- fi
-
- if [ $LAYERED = "1" ]; then
- $IDLBIN/make_link $PRODUCTBIN/$PRODUCT /usr/local/bin/$PRODUCT
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $PRODUCTBIN/$PRODUCT /usr/local/bin/$PRODUCT_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $PRODUCTBIN/$PRODUCT_RT /usr/local/bin/$PRODUCT_RT
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $PRODUCTBIN/$PRODUCT_RT /usr/local/bin/$PRODUCT_RT_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $PRODUCTBIN/$PRODUCTHELP /usr/local/bin/$PRODUCTHELP
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $PRODUCTBIN/$PRODUCTHELP /usr/local/bin/$PRODUCTHELP_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
- fi
-
- $IDLBIN/make_link $IDLBIN/idl /usr/local/bin/idl_$IDL_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idl /usr/local/bin/idl
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idlde /usr/local/bin/idlde_$IDL_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idlde /usr/local/bin/idlde
- if [ $? != 0 ]; then STATUS=1; fi
-
- # $IDLBIN/make_link $IDLBIN/idldemo /usr/local/bin/idldemo_$IDL_VERSION
- # if [ $? != 0 ]; then STATUS=1; fi
-
- # $IDLBIN/make_link $IDLBIN/idldemo /usr/local/bin/idldemo
- # if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idlhelp /usr/local/bin/idlhelp_$IDL_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idlhelp /usr/local/bin/idlhelp
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idlrpc /usr/local/bin/idlrpc_$IDL_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/idlrpc /usr/local/bin/idlrpc
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/insight /usr/local/bin/insight_$IDL_VERSION
- if [ $? != 0 ]; then STATUS=1; fi
-
- $IDLBIN/make_link $IDLBIN/insight /usr/local/bin/insight
- if [ $? != 0 ]; then STATUS=1; fi
-
-
- if [ "$STATUS" != "0" ]; then
- echo "
- Not all symbolic links were successfully installed.
- Here are your options:
-
- 1) Correct the problem that caused this failure and
- re-execute install. (It is OK to execute install more
- than once). Install was run as:
-
- $0 $1 $2
-
- 2) Manually create the missing symbolic links.
-
- 3) Have all $NAME users on your system use the $PRODUCT_setup
- file as described above.
-
- "
- fi
- fi
-
- echo "
-
- $NAME Installation Complete."
-
-